﻿@model Apps.Models.WMS.WMS_POModel
@using Apps.Web.Core;
@using Apps.Common;
@using Apps.Models.WMS;
@using Apps.Web;
@using Apps.Locale;
@using Apps.Models.Sys;
@{
    ViewBag.Title = "创建";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;

    @*<script language=javascript src="/Scripts/easyui.combobox.py.js"></script>*@
}

<script type="text/javascript">
$(function () {
    $("#btnSave").click(function () {
        if ($("form").valid()) {
            $.ajax({
                url: "@Url.Action("Create")",
                type: "Post",
                data: $("form").serialize(),
                dataType: "json",
                success: function (data) {
                    if (data.type == 1) {
                        window.parent.frameReturnByMes(data.message);
                        window.parent.frameReturnByReload(true);
                        window.parent.frameReturnByClose()
                    }
                    else {
                        window.parent.frameReturnByMes(data.message);
                    }
                }
            });
        }
        return false;
    });
    $("#btnReturn").click(function () {
         window.parent.frameReturnByClose();
    });
});
function frameReturnByClose() {
$("#modalwindow").window('close');
}
function frameReturnByMes(mes) {
$.messageBox5s(Lang.Tip, mes);
    }
</script>
<div id="modalwindow" class="easyui-window" style="width:800px; height:400px;" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
<div class="mvctool bgb">
    @Html.ToolButton("btnSave", "fa fa-save", Resource.Save, ref perm, "Save", true)
    @Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply, false)
</div>
@using (Html.BeginForm())
{
    @Html.HiddenFor(model => model.Id, new { @Value = 0 })
    <input id="CreateTime" type="hidden" name="CreateTime" value="2000-1-1" />
    <table class="formtable">
        <tbody>
            <tr>
                <th>
                    @Html.LabelFor(model => model.PO)：
                </th>
                <td>
                    @Html.EditorFor(model => model.PO)
                </td>
                <td>@Html.ValidationMessageFor(model => model.PO)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.PODate)：
                </th>
                <td>
                    @*@Html.EditorFor(model => model.PODate)*@
                    @Html.TextBoxFor(model => model.PODate, new { @onClick = "WdatePicker()", @class = "Wdate", @Value = DateTime.Now.ToString("yyyy-MM-dd") })
                </td>
                <td>@Html.ValidationMessageFor(model => model.PODate)</td>
            </tr>
            <tr>
                <th>
                    供应商：
                </th>
                <td>
                    @*@Html.EditorFor(model => model.SupplierId)*@
                    @*@Html.DropDownListFor(model => model.SupplierId, ViewBag.Supplier as SelectList, new { @class = "easyui-combobox", @data_options = "filter:filterComboPY" })*@
                    
                    <div style="height:0;width:0;overflow:hidden">
                        @Html.EditorFor(model => model.SupplierId)
                    </div>
                    <input id="SupplierList" name="SupplierList" readonly="readonly" type="text" style="width: 180px; display: inline; background: #dedede; ">
                    <a class="fa fa-plus-square color-gray fa-lg" href="javascript:showSelSupplier()"></a>
                    <script type="text/javascript">
                        function showSelSupplier()
                        {
                            $("#modalwindow").html("<iframe width='100%' height='100%' scrolling='no' frameborder='0'' src='/WMS/Supplier/SupplierLookUp'></iframe>");
                            $("#modalwindow").window({ title: '选择供应商', width: 720, height: 488, iconCls: 'fa fa-plus' }).window('open');
                        }

                        function SetSelResult(result, resultName)
                        {
                            $("#SupplierId").val(result);
                            $("#SupplierList").val(resultName);
                        }

                    </script>
                </td>
                <td>@Html.ValidationMessageFor(model => model.SupplierId)</td>
            </tr>
            <tr>
                <th>
                    @*@Html.LabelFor(model => model.PartId)：*@
                    零件代码：
                </th>
                <td>
                    @*@Html.EditorFor(model => model.PartId)*@

                    <div style="height:0;width:0;overflow:hidden">
                        @Html.EditorFor(model => model.PartId)
                    </div>
                    <input id="PartList" name="PartList" readonly="readonly" type="text" style="width: 180px; display: inline; background: #dedede; ">
                    <a class="fa fa-plus-square color-gray fa-lg" href="javascript:showSelPart()"></a>
                    <script type="text/javascript">
                        function showSelPart()
                        {
                            $("#modalwindow").html("<iframe width='100%' height='100%' scrolling='no' frameborder='0'' src='/WMS/Part/PartLookUp'></iframe>");
                            //$("#modalwindow").window({ title: '选择物料', width: 720, height: 488, iconCls: 'fa fa-plus' }).window('open');
                            $("#modalwindow").window({ title: '选择物料', width: SetGridWidthSub(20), height: SetGridHeightSub(45), iconCls: 'fa fa-plus' }).window('open');
                        }

                        function SetSelResultForPart(result, resultName)
                        {
                            $("#PartId").val(result);
                            $("#PartList").val(resultName);
                        }

                    </script>
                </td>
                <td>@Html.ValidationMessageFor(model => model.PartId)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.QTY)：
                </th>
                <td>
                    @Html.EditorFor(model => model.QTY)
                </td>
                <td>@Html.ValidationMessageFor(model => model.QTY)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.PlanDate)：
                </th>
                <td>
                    @*@Html.EditorFor(model => model.PlanDate)*@
                    @Html.TextBoxFor(model => model.PlanDate, new { @onClick = "WdatePicker()", @class = "Wdate", @Value = DateTime.Now.ToString("yyyy-MM-dd") })
                </td>
                <td>@Html.ValidationMessageFor(model => model.PlanDate)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.POType)：
                </th>
                <td>
                    @*@Html.EditorFor(model => model.POType)*@
                    @Html.DropDownListFor(model => model.POType, Apps.BLL.Sys.SysParamBLL.GetSysParamByType("POType"))
                </td>
                <td>@Html.ValidationMessageFor(model => model.POType)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Status)：
                </th>
                <td>
                    @Html.DropDownListFor(model => model.Status, Apps.BLL.Sys.SysParamBLL.GetSysParamByType("POStatus"))
                </td>
                <td>@Html.ValidationMessageFor(model => model.Status)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Remark)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Remark)
                </td>
                <td>@Html.ValidationMessageFor(model => model.Remark)</td>
            </tr>
            @*<tr>
                <th>
                    @Html.LabelFor(model => model.Attr1)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Attr1)
                </td>
                <td>@Html.ValidationMessageFor(model => model.Attr1)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Attr2)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Attr2)
                </td>
                <td>@Html.ValidationMessageFor(model => model.Attr2)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Attr3)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Attr3)
                </td>
                <td>@Html.ValidationMessageFor(model => model.Attr3)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Attr4)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Attr4)
                </td>
                <td>@Html.ValidationMessageFor(model => model.Attr4)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Attr5)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Attr5)
                </td>
                <td>@Html.ValidationMessageFor(model => model.Attr5)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.CreatePerson)：
                </th>
                <td>
                    @Html.EditorFor(model => model.CreatePerson)
                </td>
                <td>@Html.ValidationMessageFor(model => model.CreatePerson)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.ModifyPerson)：
                </th>
                <td>
                    @Html.EditorFor(model => model.ModifyPerson)
                </td>
                <td>@Html.ValidationMessageFor(model => model.ModifyPerson)</td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.ModifyTime)：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.ModifyTime, new { @onClick = "WdatePicker()", @style = "width: 105px" })
                </td>
                <td>
                    @Html.ValidationMessageFor(model => model.ModifyTime)
                </td>
            </tr>*@
        </tbody>
    </table>
}

